home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: LaTeX Document
(document/latex).
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| LaTeX Document (document/latex)
| magic
| Supported |
1%
| dexvert
| Corel 10 Texture (image/corel10Texture)
| ext
| Unsupported |
1%
| dexvert
| Croteam texture file (image/croteamTextureFile)
| ext
| Unsupported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| LaTeX document text
| default
| |
99%
| file
| LaTeX document, ASCII text
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| detectItEasy
| Format: plain text[LF]
| default (weak)
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 5c 64 6f 63 75 6d 65 6e | 74 73 74 79 6c 65 5b 31 |\documen|tstyle[1|
|00000010| 31 70 74 2c 74 77 6f 73 | 69 64 65 2c 6d 61 6e 70 |1pt,twos|ide,manp|
|00000020| 61 67 65 5d 7b 72 65 70 | 6f 72 74 7d 0a 5c 62 65 |age]{rep|ort}.\be|
|00000030| 67 69 6e 7b 64 6f 63 75 | 6d 65 6e 74 7d 0a 5c 70 |gin{docu|ment}.\p|
|00000040| 61 67 65 73 74 79 6c 65 | 7b 68 65 61 64 69 6e 67 |agestyle|{heading|
|00000050| 73 7d 0a 20 0a 5c 62 65 | 67 69 6e 7b 6d 61 6e 70 |s}. .\be|gin{manp|
|00000060| 61 67 65 7d 7b 4f 49 4d | 20 43 2b 2b 20 4c 69 62 |age}{OIM| C++ Lib|
|00000070| 72 61 72 79 7d 7b 43 68 | 6f 69 63 65 7d 7b 56 65 |rary}{Ch|oice}{Ve|
|00000080| 72 73 69 6f 6e 20 31 2e | 30 7d 0a 20 0a 5c 73 75 |rsion 1.|0}. .\su|
|00000090| 62 74 69 74 6c 65 7b 4e | 61 6d 65 7d 0a 20 20 20 |btitle{N|ame}. |
|000000a0| 20 43 68 6f 69 63 65 20 | 2d 2d 2d 20 61 20 73 65 | Choice |--- a se|
|000000b0| 74 20 6f 66 20 62 6f 78 | 65 73 20 72 65 70 72 65 |t of box|es repre|
|000000c0| 73 65 6e 74 69 6e 67 20 | 74 68 65 20 63 68 6f 69 |senting |the choi|
|000000d0| 63 65 73 20 61 76 61 69 | 6c 61 62 6c 65 2e 20 0a |ces avai|lable. .|
|000000e0| 20 0a 5c 73 75 62 74 69 | 74 6c 65 7b 44 65 63 6c | .\subti|tle{Decl|
|000000f0| 61 72 61 74 69 6f 6e 7d | 0a 20 20 20 20 5c 23 69 |aration}|. \#i|
|00000100| 6e 63 6c 75 64 65 20 5c | 3c 63 68 6f 69 63 65 2e |nclude \|<choice.|
|00000110| 68 5c 3e 0a 20 0a 5c 66 | 75 6e 63 74 69 6f 6e 7b |h\>. .\f|unction{|
|00000120| 43 68 6f 69 63 65 28 50 | 6f 69 6e 74 20 6f 72 69 |Choice(P|oint ori|
|00000130| 67 69 6e 2c 20 50 6f 69 | 6e 74 20 63 6f 72 6e 65 |gin, Poi|nt corne|
|00000140| 72 2c 0a 09 09 69 6e 74 | 20 66 6f 72 65 67 72 6f |r,...int| foregro|
|00000150| 75 6e 64 5f 63 6f 6c 6f | 72 2c 20 69 6e 74 20 62 |und_colo|r, int b|
|00000160| 61 63 6b 67 72 6f 75 6e | 64 5f 63 6f 6c 6f 72 2c |ackgroun|d_color,|
|00000170| 0a 09 09 69 6e 74 20 66 | 72 61 6d 65 5f 73 74 79 |...int f|rame_sty|
|00000180| 6c 65 2c 20 69 6e 74 20 | 73 70 61 63 65 5f 69 6e |le, int |space_in|
|00000190| 5f 62 65 74 77 65 65 6e | 2c 0a 20 20 20 20 20 20 |_between|,. |
|000001a0| 20 20 20 20 20 20 20 20 | 20 20 69 6e 74 20 6e 75 | | int nu|
|000001b0| 6d 62 65 72 5f 6f 66 5f | 63 68 6f 69 63 65 73 2c |mber_of_|choices,|
|000001c0| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|000001d0| 20 63 6f 6e 73 74 7e 63 | 68 61 72 5c 2a 20 66 69 | const~c|har\* fi|
|000001e0| 72 73 74 5f 6c 61 62 65 | 6c 2c 20 24 2e 2e 2e 24 |rst_labe|l, $...$|
|000001f0| 29 7d 0a 20 20 20 20 43 | 6f 6e 73 74 72 75 63 74 |)}. C|onstruct|
|00000200| 73 20 61 20 63 68 6f 69 | 63 65 20 6f 62 6a 65 63 |s a choi|ce objec|
|00000210| 74 2e 20 20 45 61 63 68 | 20 63 68 6f 69 63 65 20 |t. Each| choice |
|00000220| 6f 62 6a 65 63 74 20 69 | 73 20 61 20 73 65 74 20 |object i|s a set |
|00000230| 6f 66 20 62 6f 78 65 73 | 0a 20 20 20 20 72 65 70 |of boxes|. rep|
|00000240| 72 65 73 65 6e 74 69 6e | 67 20 74 68 65 20 63 68 |resentin|g the ch|
|00000250| 6f 69 63 65 73 20 61 76 | 61 69 6c 61 62 6c 65 2e |oices av|ailable.|
|00000260| 20 20 22 4f 72 69 67 69 | 6e 22 20 61 6e 64 20 22 | "Origi|n" and "|
|00000270| 63 6f 72 6e 65 72 22 20 | 64 65 66 69 6e 65 20 74 |corner" |define t|
|00000280| 68 65 0a 20 20 20 20 72 | 65 63 74 61 6e 67 75 6c |he. r|ectangul|
|00000290| 61 72 20 61 72 65 61 20 | 69 6e 73 69 64 65 20 77 |ar area |inside w|
|000002a0| 68 69 63 68 20 74 68 65 | 20 62 6f 78 65 73 20 61 |hich the| boxes a|
|000002b0| 72 65 20 64 69 73 70 6c | 61 79 65 64 2e 20 0a 20 |re displ|ayed. . |
|000002c0| 20 20 20 54 68 65 20 22 | 73 70 61 63 65 5f 69 6e | The "|space_in|
|000002d0| 5f 62 65 74 77 65 65 6e | 22 20 28 69 6e 20 70 69 |_between|" (in pi|
|000002e0| 78 65 6c 73 29 0a 20 20 | 20 20 64 65 66 69 6e 65 |xels). | define|
|000002f0| 73 20 74 68 65 20 64 69 | 73 74 61 6e 63 65 20 62 |s the di|stance b|
|00000300| 65 74 77 65 65 6e 20 74 | 77 6f 20 61 64 6a 61 63 |etween t|wo adjac|
|00000310| 65 6e 74 20 62 6f 78 65 | 73 2e 20 20 44 65 70 65 |ent boxe|s. Depe|
|00000320| 6e 64 69 6e 67 20 6f 6e | 20 0a 20 20 20 20 77 68 |nding on| . wh|
|00000330| 65 74 68 65 72 20 74 68 | 65 72 65 20 69 73 20 65 |ether th|ere is e|
|00000340| 6e 6f 75 67 68 20 72 6f | 6f 6d 20 74 6f 20 70 75 |nough ro|om to pu|
|00000350| 74 20 61 6c 6c 20 74 68 | 65 20 63 68 6f 69 63 65 |t all th|e choice|
|00000360| 73 20 68 6f 72 69 7a 6f | 6e 74 61 6c 6c 79 0a 20 |s horizo|ntally. |
|00000370| 20 20 20 6f 72 20 76 65 | 72 74 69 63 61 6c 6c 79 | or ve|rtically|
|00000380| 20 69 6e 20 74 68 65 20 | 64 65 73 69 67 6e 61 74 | in the |designat|
|00000390| 65 64 20 61 72 65 61 2c | 0a 20 20 20 20 74 68 65 |ed area,|. the|
|000003a0| 20 63 68 6f 69 63 65 73 | 20 77 69 6c 6c 20 62 65 | choices| will be|
|000003b0| 20 6c 61 69 64 20 6f 75 | 74 20 61 63 63 6f 72 64 | laid ou|t accord|
|000003c0| 69 6e 67 6c 79 2e 20 20 | 54 68 65 0a 20 20 20 20 |ingly. |The. |
|000003d0| 61 74 74 72 69 62 75 74 | 65 73 20 22 66 6f 72 65 |attribut|es "fore|
|000003e0| 67 72 6f 75 6e 64 5f 63 | 6f 6c 6f 72 22 2c 20 22 |ground_c|olor", "|
|000003f0| 62 61 63 6b 67 72 6f 75 | 6e 64 5f 63 6f 6c 6f 72 |backgrou|nd_color|
|00000400| 22 20 61 6e 64 20 22 66 | 72 61 6d 65 5f 73 74 79 |" and "f|rame_sty|
|00000410| 6c 65 22 0a 20 20 20 20 | 64 65 66 69 6e 65 20 74 |le". |define t|
|00000420| 68 65 20 63 6f 6c 6f 72 | 73 20 66 6f 72 20 65 61 |he color|s for ea|
|00000430| 63 68 20 62 6f 78 20 74 | 68 61 74 20 72 65 70 72 |ch box t|hat repr|
|00000440| 65 73 65 6e 74 73 20 65 | 61 63 68 20 63 68 6f 69 |esents e|ach choi|
|00000450| 63 65 2e 0a 20 20 20 20 | 54 68 65 20 6e 75 6d 62 |ce.. |The numb|
|00000460| 65 72 20 6f 66 20 6c 61 | 62 65 6c 73 20 73 74 61 |er of la|bels sta|
|00000470| 72 74 69 6e 67 20 77 69 | 74 68 20 22 66 69 72 73 |rting wi|th "firs|
|00000480| 74 5f 6c 61 62 65 6c 22 | 20 6d 75 73 74 20 6d 61 |t_label"| must ma|
|00000490| 74 63 68 20 74 68 65 0a | 20 20 20 20 6e 75 6d 62 |tch the.| numb|
|000004a0| 65 72 20 67 69 76 65 6e | 20 62 79 20 22 6e 75 6d |er given| by "num|
|000004b0| 62 65 72 5f 6f 66 5f 63 | 68 6f 69 63 65 73 22 2e |ber_of_c|hoices".|
|000004c0| 20 20 45 61 63 68 20 6c | 61 62 65 6c 20 69 73 20 | Each l|abel is |
|000004d0| 64 69 73 70 6c 61 79 65 | 64 20 77 69 74 68 69 6e |displaye|d within|
|000004e0| 0a 20 20 20 20 69 74 73 | 20 63 6f 72 72 65 73 70 |. its| corresp|
|000004f0| 6f 6e 64 69 6e 67 20 62 | 6f 78 2e 20 20 54 68 65 |onding b|ox. The|
|00000500| 20 63 68 6f 69 63 65 73 | 20 61 72 65 20 64 69 73 | choices| are dis|
|00000510| 70 6c 61 79 65 64 20 0a | 20 20 20 20 61 73 20 73 |played .| as s|
|00000520| 6f 6f 6e 20 61 73 20 74 | 68 65 79 20 61 72 65 20 |oon as t|hey are |
|00000530| 63 72 65 61 74 65 64 2e | 0a 20 0a 5c 66 75 6e 63 |created.|. .\func|
|00000540| 74 69 6f 6e 7b 43 68 6f | 69 63 65 28 69 6e 74 20 |tion{Cho|ice(int |
|00000550| 6e 75 6d 62 65 72 5f 6f | 66 5f 63 68 6f 69 63 65 |number_o|f_choice|
|00000560| 73 2c 20 42 6f 6f 6c 65 | 61 6e 20 69 73 5f 68 6f |s, Boole|an is_ho|
|00000570| 72 69 7a 6f 6e 74 61 6c | 20 3d 20 56 49 52 54 49 |rizontal| = VIRTI|
|00000580| 43 41 4c 29 7d 0a 20 20 | 20 20 43 6f 6e 73 74 72 |CAL)}. | Constr|
|00000590| 75 63 74 73 20 61 6e 20 | 61 72 72 61 79 20 6f 66 |ucts an |array of|
|000005a0| 20 63 68 6f 69 63 65 73 | 20 6f 72 20 0a 20 20 20 | choices| or . |
|000005b0| 20 61 20 63 68 6f 69 63 | 65 20 6f 62 6a 65 63 74 | a choic|e object|
|000005c0| 20 77 69 74 68 20 62 6f | 78 65 73 20 6f 66 20 64 | with bo|xes of d|
|000005d0| 69 66 66 65 72 65 6e 74 | 20 73 69 7a 65 73 2e 20 |ifferent| sizes. |
|000005e0| 20 54 68 65 20 61 74 74 | 72 69 62 75 74 65 73 0a | The att|ributes.|
|000005f0| 20 20 20 20 6f 66 20 74 | 68 65 20 61 63 74 75 61 | of t|he actua|
|00000600| 6c 20 63 68 6f 69 63 65 | 73 20 77 69 6c 6c 20 62 |l choice|s will b|
|00000610| 65 20 64 65 66 69 6e 65 | 64 20 6c 61 74 65 72 20 |e define|d later |
|00000620| 75 73 69 6e 67 20 74 68 | 65 0a 20 20 20 20 61 64 |using th|e. ad|
|00000630| 64 49 74 65 6d 28 29 20 | 6f 70 65 72 61 74 69 6f |dItem() |operatio|
|00000640| 6e 2e 20 4e 6f 74 65 3a | 20 49 74 20 69 73 20 66 |n. Note:| It is f|
|00000650| 6f 72 62 69 64 64 65 6e | 20 74 6f 20 68 61 76 65 |orbidden| to have|
|00000660| 20 61 72 67 75 6d 65 6e | 74 73 0a 20 20 20 20 69 | argumen|ts. i|
|00000670| 6e 20 74 68 65 20 63 6f | 6e 73 74 72 75 63 74 6f |n the co|nstructo|
|00000680| 72 73 20 6f 66 20 61 72 | 72 61 79 20 6f 62 6a 65 |rs of ar|ray obje|
|00000690| 63 74 73 20 69 6e 20 43 | 2b 2b 2e 20 0a 20 0a 5c |cts in C|++. . .\|
|000006a0| 73 75 62 74 69 74 6c 65 | 7b 44 65 73 63 72 69 70 |subtitle|{Descrip|
|000006b0| 74 69 6f 6e 7d 0a 20 20 | 20 20 41 20 43 68 6f 69 |tion}. | A Choi|
|000006c0| 63 65 20 6f 62 6a 65 63 | 74 20 69 73 20 61 20 73 |ce objec|t is a s|
|000006d0| 65 74 20 6f 66 20 72 65 | 6c 61 74 65 64 20 62 6f |et of re|lated bo|
|000006e0| 78 65 73 2e 20 49 74 20 | 69 73 20 75 73 65 64 20 |xes. It |is used |
|000006f0| 74 6f 20 64 69 73 70 6c | 61 79 0a 20 20 20 20 6d |to displ|ay. m|
|00000700| 75 6c 74 69 70 6c 65 20 | 63 68 6f 69 63 65 73 20 |ultiple |choices |
|00000710| 6f 6e 20 74 68 65 20 73 | 63 72 65 65 6e 2e 20 0a |on the s|creen. .|
|00000720| 20 20 20 20 41 20 63 68 | 6f 69 63 65 20 6d 61 79 | A ch|oice may|
|00000730| 20 65 69 74 68 65 72 20 | 62 65 20 73 65 6c 65 63 | either |be selec|
|00000740| 74 65 64 20 62 79 20 70 | 72 65 73 73 69 6e 67 20 |ted by p|ressing |
|00000750| 61 20 68 6f 74 20 6b 65 | 79 0a 20 20 20 20 28 77 |a hot ke|y. (w|
|00000760| 68 65 6e 20 6d 6f 75 73 | 65 20 69 73 20 6e 6f 74 |hen mous|e is not|
|00000770| 20 65 6e 61 62 6c 65 64 | 29 20 6f 72 20 62 79 20 | enabled|) or by |
|00000780| 70 72 65 73 73 69 6e 67 | 20 61 20 6d 6f 75 73 65 |pressing| a mouse|
|00000790| 20 62 75 74 74 6f 6e 20 | 77 68 65 6e 20 74 68 65 | button |when the|
|000007a0| 20 6d 6f 75 73 65 0a 20 | 20 20 20 63 75 72 73 6f | mouse. | curso|
|000007b0| 72 20 69 73 20 77 69 74 | 68 69 6e 20 74 68 65 20 |r is wit|hin the |
|000007c0| 69 6e 74 65 6e 64 65 64 | 20 63 68 6f 69 63 65 20 |intended| choice |
|000007d0| 62 6f 78 2e 20 20 0a 20 | 20 20 20 54 68 65 20 66 |box. . | The f|
|000007e0| 69 72 73 74 20 68 69 67 | 68 6c 69 67 68 74 65 64 |irst hig|hlighted|
|000007f0| 20 63 68 61 72 61 63 74 | 65 72 20 69 6e 20 74 68 | charact|er in th|
|00000800| 65 20 74 65 78 74 20 6c | 61 62 65 6c 20 77 69 6c |e text l|abel wil|
|00000810| 6c 20 62 65 20 74 68 65 | 20 0a 20 20 20 20 68 6f |l be the| . ho|
|00000820| 74 20 6b 65 79 20 69 66 | 20 74 68 65 20 6d 6f 75 |t key if| the mou|
|00000830| 73 65 20 69 73 20 6e 6f | 74 20 65 6e 61 62 6c 65 |se is no|t enable|
|00000840| 64 2c 20 6f 74 68 65 72 | 77 69 73 65 2c 20 74 68 |d, other|wise, th|
|00000850| 65 20 68 69 67 68 6c 69 | 67 68 74 65 64 0a 20 20 |e highli|ghted. |
|00000860| 20 20 63 68 61 72 61 63 | 74 65 72 20 77 69 6c 6c | charac|ter will|
|00000870| 20 68 61 76 65 20 6e 6f | 20 65 66 66 65 63 74 2e | have no| effect.|
|00000880| 20 46 6f 72 20 65 78 61 | 6d 70 6c 65 2c 20 6c 61 | For exa|mple, la|
|00000890| 62 65 6c 20 22 40 4e 40 | 65 78 74 22 20 64 65 73 |bel "@N@|ext" des|
|000008a0| 69 67 6e 61 74 65 73 0a | 20 20 20 20 22 4e 22 20 |ignates.| "N" |
|000008b0| 61 73 20 74 68 65 20 68 | 6f 74 20 6b 65 79 20 66 |as the h|ot key f|
|000008c0| 6f 72 20 74 68 65 20 62 | 75 74 74 6f 6e 20 69 66 |or the b|utton if|
|000008d0| 20 74 68 65 20 6d 6f 75 | 73 65 20 69 73 20 6e 6f | the mou|se is no|
|000008e0| 74 20 65 6e 61 62 6c 65 | 64 2e 0a 20 20 20 20 42 |t enable|d.. B|
|000008f0| 79 20 64 65 66 61 75 6c | 74 2c 20 69 66 20 74 68 |y defaul|t, if th|
|00000900| 65 20 6d 6f 75 73 65 20 | 64 72 69 76 65 72 20 69 |e mouse |driver i|
|00000910| 73 20 6c 6f 61 64 65 64 | 20 62 65 66 6f 72 65 20 |s loaded| before |
|00000920| 70 72 6f 67 72 61 6d 20 | 65 78 65 63 75 74 69 6f |program |executio|
|00000930| 6e 2c 0a 20 20 20 20 74 | 68 65 20 6d 6f 75 73 65 |n,. t|he mouse|
|00000940| 20 69 73 20 65 6e 61 62 | 6c 65 64 2e 0a 20 20 20 | is enab|led.. |
|00000950| 20 57 68 65 6e 20 75 73 | 69 6e 67 20 74 68 65 20 | When us|ing the |
|00000960| 6d 6f 75 73 65 20 74 6f | 20 73 65 6c 65 63 74 0a |mouse to| select.|
|00000970| 20 20 20 20 61 20 63 68 | 6f 69 63 65 2c 20 74 68 | a ch|oice, th|
|00000980| 65 20 73 65 6c 65 63 74 | 69 6f 6e 20 69 73 20 69 |e select|ion is i|
|00000990| 6d 6d 65 64 69 61 74 65 | 3b 20 61 20 68 6f 74 20 |mmediate|; a hot |
|000009a0| 6b 65 79 20 6d 75 73 74 | 20 62 65 20 63 6f 6e 66 |key must| be conf|
|000009b0| 69 72 6d 65 64 0a 20 20 | 20 20 62 79 20 70 72 65 |irmed. | by pre|
|000009c0| 73 73 69 6e 67 20 45 4e | 54 45 52 20 28 63 61 72 |ssing EN|TER (car|
|000009d0| 72 69 61 67 65 20 72 65 | 74 75 72 6e 20 6b 65 79 |riage re|turn key|
|000009e0| 29 2e 20 20 41 72 72 6f | 77 20 6b 65 79 73 20 63 |). Arro|w keys c|
|000009f0| 61 6e 20 61 6c 73 6f 20 | 62 65 20 75 73 65 64 0a |an also |be used.|
|00000a00| 20 20 20 20 74 6f 20 6d | 6f 76 65 20 74 68 65 20 | to m|ove the |
|00000a10| 63 75 72 72 65 6e 74 20 | 73 65 6c 65 63 74 69 6f |current |selectio|
|00000a20| 6e 20 69 6e 20 74 68 65 | 20 64 69 72 65 63 74 69 |n in the| directi|
|00000a30| 6f 6e 20 69 6e 64 69 63 | 61 74 65 64 20 62 79 20 |on indic|ated by |
|00000a40| 74 68 65 20 61 72 72 6f | 77 73 2c 0a 20 20 20 20 |the arro|ws,. |
|00000a50| 74 68 69 73 20 61 6c 73 | 6f 20 72 65 71 75 69 72 |this als|o requir|
|00000a60| 65 73 20 61 6e 20 45 4e | 54 45 52 20 74 6f 20 63 |es an EN|TER to c|
|00000a70| 6f 6e 66 69 72 6d 2e 0a | 20 0a 5c 73 75 62 74 69 |onfirm..| .\subti|
|00000a80| 74 6c 65 7b 50 75 62 6c | 69 63 20 5c 5c 20 4f 70 |tle{Publ|ic \\ Op|
|00000a90| 65 72 61 74 69 6f 6e 73 | 7d 0a 20 0a 5c 66 75 6e |erations|}. .\fun|
|00000aa0| 63 74 69 6f 6e 7b 76 6f | 69 64 20 61 64 64 49 74 |ction{vo|id addIt|
|00000ab0| 65 6d 28 50 6f 69 6e 74 | 20 6f 72 69 67 69 6e 2c |em(Point| origin,|
|00000ac0| 20 50 6f 69 6e 74 20 63 | 6f 72 6e 65 72 2c 0a 09 | Point c|orner,..|
|00000ad0| 09 20 69 6e 74 20 66 6f | 72 65 67 72 6f 75 6e 64 |. int fo|reground|
|00000ae0| 5f 63 6f 6c 6f 72 2c 20 | 69 6e 74 20 62 61 63 6b |_color, |int back|
|00000af0| 67 72 6f 75 6e 64 5f 63 | 6f 6c 6f 72 2c 0a 09 09 |ground_c|olor,...|
|00000b00| 20 69 6e 74 20 66 72 61 | 6d 65 5f 73 74 79 6c 65 | int fra|me_style|
|00000b10| 2c 20 63 6f 6e 73 74 7e | 63 68 61 72 5c 2a 20 6c |, const~|char\* l|
|00000b20| 61 62 65 6c 2c 0a 09 09 | 20 69 6e 74 20 74 65 78 |abel,...| int tex|
|00000b30| 74 5f 63 6f 6c 6f 72 20 | 3d 20 57 48 49 54 45 2c |t_color |= WHITE,|
|00000b40| 0a 09 09 20 69 6e 74 20 | 74 65 78 74 5f 68 69 67 |... int |text_hig|
|00000b50| 68 6c 69 67 68 74 5f 63 | 6f 6c 6f 72 20 3d 20 4c |hlight_c|olor = L|
|00000b60| 49 47 48 54 5f 57 48 49 | 54 45 29 7d 0a 20 20 20 |IGHT_WHI|TE)}. |
|00000b70| 20 44 65 66 69 6e 65 73 | 20 74 68 65 20 61 74 74 | Defines| the att|
|00000b80| 72 69 62 75 74 65 73 20 | 6f 66 20 61 20 63 68 6f |ributes |of a cho|
|00000b90| 69 63 65 20 62 6f 78 20 | 69 6e 20 74 68 65 20 61 |ice box |in the a|
|00000ba0| 72 72 61 79 20 64 65 63 | 6c 61 72 65 64 20 62 79 |rray dec|lared by|
|00000bb0| 20 74 68 65 0a 20 20 20 | 20 43 68 6f 69 63 65 28 | the. | Choice(|
|00000bc0| 69 6e 74 20 22 6e 75 6d | 62 65 72 5f 6f 66 5f 63 |int "num|ber_of_c|
|00000bd0| 68 6f 69 63 65 73 22 2c | 20 42 6f 6f 6c 65 61 6e |hoices",| Boolean|
|00000be0| 20 22 69 73 5f 68 6f 72 | 69 7a 6f 6e 74 61 6c 22 | "is_hor|izontal"|
|00000bf0| 20 3d 20 56 49 52 54 49 | 43 41 4c 29 20 0a 20 20 | = VIRTI|CAL) . |
|00000c00| 20 20 63 6f 6e 73 74 72 | 75 63 74 6f 72 2e 20 0a | constr|uctor. .|
|00000c10| 20 20 20 20 49 74 20 6d | 75 73 74 20 62 65 20 63 | It m|ust be c|
|00000c20| 61 6c 6c 65 64 20 65 78 | 61 63 74 6c 79 20 22 6e |alled ex|actly "n|
|00000c30| 75 6d 62 65 72 5f 6f 66 | 5f 63 68 6f 69 63 65 73 |umber_of|_choices|
|00000c40| 22 0a 20 20 20 20 74 69 | 6d 65 73 2e 20 20 54 68 |". ti|mes. Th|
|00000c50| 65 20 66 69 72 73 74 20 | 63 61 6c 6c 20 73 70 65 |e first |call spe|
|00000c60| 63 69 66 69 65 73 20 74 | 68 65 20 66 69 72 73 74 |cifies t|he first|
|00000c70| 20 63 68 6f 69 63 65 2c | 20 73 65 63 6f 6e 64 20 | choice,| second |
|00000c80| 63 61 6c 6c 20 73 70 65 | 63 69 66 69 65 73 0a 20 |call spe|cifies. |
|00000c90| 20 20 20 74 68 65 20 73 | 65 63 6f 6e 64 20 63 68 | the s|econd ch|
|00000ca0| 6f 69 63 65 2c 20 61 6e | 64 20 73 6f 20 6f 6e 2e |oice, an|d so on.|
|00000cb0| 20 20 54 68 65 20 61 74 | 74 72 69 62 75 74 65 73 | The at|tributes|
|00000cc0| 20 22 6f 72 69 67 69 6e | 22 20 61 6e 64 20 22 63 | "origin|" and "c|
|00000cd0| 6f 72 6e 65 72 22 0a 20 | 20 20 20 64 65 66 69 6e |orner". | defin|
|00000ce0| 65 20 61 20 62 6f 78 20 | 61 72 65 61 20 77 68 65 |e a box |area whe|
|00000cf0| 72 65 20 74 68 65 20 63 | 68 6f 69 63 65 20 69 74 |re the c|hoice it|
|00000d00| 65 6d 20 69 73 20 6c 6f | 63 61 74 65 64 20 6f 6e |em is lo|cated on|
|00000d10| 20 74 68 65 20 73 63 72 | 65 65 6e 2e 20 20 4f 74 | the scr|een. Ot|
|00000d20| 68 65 72 0a 20 20 20 20 | 61 74 74 72 69 62 75 74 |her. |attribut|
|00000d30| 65 73 20 61 72 65 20 73 | 65 6c 66 2d 65 78 70 6c |es are s|elf-expl|
|00000d40| 61 6e 61 74 6f 72 79 2e | 20 20 54 68 69 73 20 63 |anatory.| This c|
|00000d50| 61 6c 6c 20 69 73 20 70 | 61 72 74 69 63 75 6c 61 |all is p|articula|
|00000d60| 72 6c 79 20 75 73 65 66 | 75 6c 0a 20 20 20 20 6f |rly usef|ul. o|
|00000d70| 6e 20 70 72 6f 67 72 61 | 6d 20 73 65 74 75 70 20 |n progra|m setup |
|00000d80| 70 61 67 65 73 2e 0a 20 | 0a 5c 66 75 6e 63 74 69 |pages.. |.\functi|
|00000d90| 6f 6e 7b 76 6f 69 64 20 | 64 69 73 61 62 6c 65 28 |on{void |disable(|
|00000da0| 69 6e 74 20 69 6e 64 65 | 78 29 7d 0a 20 20 20 20 |int inde|x)}. |
|00000db0| 44 69 73 61 62 6c 65 73 | 20 61 20 63 68 6f 69 63 |Disables| a choic|
|00000dc0| 65 20 62 6f 78 20 64 65 | 73 69 67 6e 61 74 65 64 |e box de|signated|
|00000dd0| 20 62 79 20 22 69 6e 64 | 65 78 22 2e 20 54 68 69 | by "ind|ex". Thi|
|00000de0| 73 20 6d 65 61 6e 73 20 | 74 68 61 74 20 74 68 65 |s means |that the|
|00000df0| 20 63 68 6f 69 63 65 0a | 20 20 20 20 63 61 6e 20 | choice.| can |
|00000e00| 73 74 69 6c 6c 20 62 65 | 20 73 65 65 6e 20 6f 6e |still be| seen on|
|00000e10| 20 74 68 65 20 73 63 72 | 65 65 6e 20 62 75 74 20 | the scr|een but |
|00000e20| 63 61 6e 20 6e 6f 74 20 | 62 65 20 73 65 6c 65 63 |can not |be selec|
|00000e30| 74 65 64 20 61 6e 79 20 | 6d 6f 72 65 2e 0a 20 20 |ted any |more.. |
|00000e40| 20 20 54 68 65 20 68 6f | 74 20 6b 65 79 20 66 6f | The ho|t key fo|
|00000e50| 72 20 74 68 65 20 63 68 | 6f 69 63 65 20 69 73 20 |r the ch|oice is |
|00000e60| 72 65 6e 64 65 72 65 64 | 20 61 73 20 69 6e 20 74 |rendered| as in t|
|00000e70| 68 65 20 6e 6f 72 6d 61 | 6c 20 74 65 78 74 20 63 |he norma|l text c|
|00000e80| 6f 6c 6f 72 20 72 61 74 | 68 65 72 0a 20 20 20 20 |olor rat|her. |
|00000e90| 74 68 61 6e 20 69 6e 20 | 74 68 65 20 68 69 67 68 |than in |the high|
|00000ea0| 6c 69 67 68 74 20 63 6f | 6c 6f 72 2e 20 20 54 68 |light co|lor. Th|
|00000eb0| 69 73 20 63 61 6c 6c 20 | 69 73 20 6f 66 74 65 6e |is call |is often|
|00000ec0| 20 75 73 65 66 75 6c 20 | 6f 6e 20 61 20 73 65 74 | useful |on a set|
|00000ed0| 75 70 20 70 61 67 65 2c | 0a 20 20 20 20 77 68 65 |up page,|. whe|
|00000ee0| 72 65 20 69 74 20 69 73 | 20 6f 66 74 65 6e 20 6e |re it is| often n|
|00000ef0| 65 63 65 73 73 61 72 79 | 20 74 6f 20 68 61 76 65 |ecessary| to have|
|00000f00| 20 61 20 66 65 77 20 63 | 68 6f 69 63 65 73 20 63 | a few c|hoices c|
|00000f10| 6f 6e 74 69 6e 67 65 6e | 74 20 75 70 6f 6e 20 0a |ontingen|t upon .|
|00000f20| 20 20 20 20 6f 74 68 65 | 72 73 2c 20 69 2e 65 2e | othe|rs, i.e.|
|00000f30| 2c 20 74 68 65 79 20 61 | 72 65 20 64 69 73 61 62 |, they a|re disab|
|00000f40| 6c 65 64 20 66 69 72 73 | 74 20 75 6e 74 69 6c 20 |led firs|t until |
|00000f50| 74 68 65 20 63 68 6f 69 | 63 65 73 20 74 68 61 74 |the choi|ces that|
|00000f60| 20 74 68 65 79 20 0a 20 | 20 20 20 64 65 70 65 6e | they . | depen|
|00000f70| 64 20 75 70 6f 6e 20 68 | 61 76 65 20 62 65 65 6e |d upon h|ave been|
|00000f80| 20 69 6e 69 74 69 61 6c | 69 7a 65 64 20 61 6e 64 | initial|ized and|
|00000f90| 20 74 68 65 6e 20 74 68 | 65 79 20 61 72 65 20 65 | then th|ey are e|
|00000fa0| 6e 61 62 6c 65 64 20 61 | 67 61 69 6e 2e 0a 20 0a |nabled a|gain.. .|
|00000fb0| 5c 66 75 6e 63 74 69 6f | 6e 7b 76 6f 69 64 20 65 |\functio|n{void e|
|00000fc0| 6e 61 62 6c 65 28 69 6e | 74 20 69 6e 64 65 78 29 |nable(in|t index)|
|00000fd0| 7d 0a 20 20 20 20 45 6e | 61 62 6c 65 73 20 61 20 |}. En|ables a |
|00000fe0| 63 68 6f 69 63 65 20 62 | 6f 78 20 64 65 73 69 67 |choice b|ox desig|
|00000ff0| 6e 61 74 65 64 20 62 79 | 20 22 69 6e 64 65 78 22 |nated by| "index"|
|00001000| 2e 0a 20 20 20 20 41 6c | 6c 20 63 68 6f 69 63 65 |.. Al|l choice|
|00001010| 73 20 61 72 65 20 65 6e | 61 62 6c 65 64 20 77 68 |s are en|abled wh|
|00001020| 65 6e 20 63 72 65 61 74 | 65 64 2e 0a 20 20 20 20 |en creat|ed.. |
|00001030| 0a 5c 66 75 6e 63 74 69 | 6f 6e 7b 42 6f 6f 6c 65 |.\functi|on{Boole|
|00001040| 61 6e 20 68 61 73 56 61 | 6c 75 65 28 29 7d 0a 20 |an hasVa|lue()}. |
|00001050| 20 20 20 52 65 74 75 72 | 6e 73 20 54 52 55 45 20 | Retur|ns TRUE |
|00001060| 69 66 20 74 68 65 20 64 | 65 73 69 67 6e 61 74 65 |if the d|esignate|
|00001070| 64 20 63 68 6f 69 63 65 | 20 6f 62 6a 65 63 74 20 |d choice| object |
|00001080| 68 61 73 20 62 65 65 6e | 20 73 65 6c 65 63 74 65 |has been| selecte|
|00001090| 64 20 61 74 0a 20 20 20 | 20 6c 65 61 73 74 20 6f |d at. | least o|
|000010a0| 6e 63 65 2e 20 20 47 72 | 61 70 68 69 63 61 6c 6c |nce. Gr|aphicall|
|000010b0| 79 2c 0a 20 20 20 20 69 | 74 20 6d 65 61 6e 73 20 |y,. i|t means |
|000010c0| 6f 6e 65 20 6f 66 20 74 | 68 65 20 63 68 6f 69 63 |one of t|he choic|
|000010d0| 65 73 20 69 73 20 72 65 | 6e 64 65 72 65 64 20 69 |es is re|ndered i|
|000010e0| 6e 20 72 65 76 65 72 73 | 65 20 63 6f 6c 6f 72 73 |n revers|e colors|
|000010f0| 2e 20 20 49 74 20 69 73 | 0a 20 20 20 20 73 6f 6d |. It is|. som|
|00001100| 65 74 69 6d 65 73 20 6e | 65 63 65 73 73 61 72 79 |etimes n|ecessary|
|00001110| 20 74 6f 20 63 68 65 63 | 6b 20 69 66 20 61 6c 6c | to chec|k if all|
|00001120| 20 63 68 6f 69 63 65 20 | 6f 62 6a 65 63 74 73 20 | choice |objects |
|00001130| 6f 6e 20 61 20 73 63 72 | 65 65 6e 20 68 61 76 65 |on a scr|een have|
|00001140| 0a 20 20 20 20 62 65 65 | 6e 20 73 65 6c 65 63 74 |. bee|n select|
|00001150| 65 64 2c 20 73 6f 20 74 | 68 61 74 20 61 20 70 72 |ed, so t|hat a pr|
|00001160| 6f 67 72 61 6d 20 63 61 | 6e 20 67 6f 20 6f 6e 20 |ogram ca|n go on |
|00001170| 74 6f 20 74 68 65 20 6e | 65 78 74 20 70 61 67 65 |to the n|ext page|
|00001180| 20 6f 66 20 73 63 72 65 | 65 6e 2e 0a 20 20 20 20 | of scre|en.. |
|00001190| 49 66 20 61 20 70 72 65 | 76 69 6f 75 73 20 73 65 |If a pre|vious se|
|000011a0| 6c 65 63 74 28 29 20 63 | 61 6c 6c 20 69 73 20 72 |lect() c|all is r|
|000011b0| 65 74 75 72 6e 65 64 20 | 61 62 6e 6f 72 6d 61 6c |eturned |abnormal|
|000011c0| 6c 79 20 62 79 20 70 72 | 65 73 73 69 6e 67 20 61 |ly by pr|essing a|
|000011d0| 6e 20 45 53 43 20 6b 65 | 79 2c 0a 20 20 20 20 74 |n ESC ke|y,. t|
|000011e0| 68 69 73 20 66 75 6e 63 | 74 69 6f 6e 20 77 69 6c |his func|tion wil|
|000011f0| 6c 20 72 65 74 75 72 6e | 20 46 41 4c 53 45 2e 20 |l return| FALSE. |
|00001200| 53 68 6f 75 6c 64 20 74 | 68 69 73 20 6f 63 63 75 |Should t|his occu|
|00001210| 72 2c 20 74 68 65 20 70 | 72 65 76 69 6f 75 73 20 |r, the p|revious |
|00001220| 0a 20 20 20 20 76 61 6c | 75 65 2c 20 69 66 20 61 |. val|ue, if a|
|00001230| 6e 79 2c 20 77 69 6c 6c | 20 61 6c 73 6f 20 62 65 |ny, will| also be|
|00001240| 20 6c 6f 73 74 2e 0a 20 | 0a 5c 66 75 6e 63 74 69 | lost.. |.\functi|
|00001250| 6f 6e 7b 69 6e 74 20 73 | 65 6c 65 63 74 4e 65 78 |on{int s|electNex|
|00001260| 74 28 29 7d 0a 20 20 20 | 20 53 74 65 70 73 20 74 |t()}. | Steps t|
|00001270| 68 72 6f 75 67 68 20 65 | 61 63 68 20 63 68 6f 69 |hrough e|ach choi|
|00001280| 63 65 20 6f 66 20 74 68 | 65 20 63 68 6f 69 63 65 |ce of th|e choice|
|00001290| 20 6f 62 6a 65 63 74 20 | 69 6e 20 73 65 71 75 65 | object |in seque|
|000012a0| 6e 74 69 61 6c 20 6f 72 | 64 65 72 2e 0a 20 20 20 |ntial or|der.. |
|000012b0| 20 54 68 69 73 20 66 75 | 6e 63 74 69 6f 6e 20 69 | This fu|nction i|
|000012c0| 73 20 6f 66 74 65 6e 20 | 75 73 65 64 20 69 6e 20 |s often |used in |
|000012d0| 69 6d 70 6c 65 6d 65 6e | 74 69 6e 67 20 70 61 72 |implemen|ting par|
|000012e0| 61 6d 65 74 65 72 20 0a | 20 20 20 20 69 6e 69 74 |ameter .| init|
|000012f0| 69 61 6c 69 7a 61 74 69 | 6f 6e 20 73 63 72 65 65 |ializati|on scree|
|00001300| 6e 73 20 69 6e 20 61 20 | 63 6f 6e 74 72 6f 6c 6c |ns in a |controll|
|00001310| 65 64 20 6f 72 64 65 72 | 2e 20 54 68 65 20 6f 72 |ed order|. The or|
|00001320| 64 65 72 20 74 68 61 74 | 20 74 68 65 20 0a 20 20 |der that| the . |
|00001330| 20 20 63 68 6f 69 63 65 | 73 20 61 72 65 20 73 74 | choice|s are st|
|00001340| 65 70 65 64 20 74 68 72 | 6f 75 67 68 20 69 73 20 |eped thr|ough is |
|00001350| 74 68 65 20 73 61 6d 65 | 20 61 73 20 74 68 65 20 |the same| as the |
|00001360| 6f 72 64 65 72 20 6f 66 | 20 74 68 65 20 63 68 6f |order of| the cho|
|00001370| 69 63 65 0a 20 20 20 20 | 61 72 72 61 79 2e 20 20 |ice. |array. |
|00001380| 54 68 69 73 20 69 73 20 | 6f 70 65 72 61 74 6f 72 |This is |operator|
|00001390| 20 69 73 20 76 61 6c 69 | 64 20 6f 6e 6c 79 20 66 | is vali|d only f|
|000013a0| 6f 72 20 6b 65 79 62 6f | 61 72 64 20 6d 6f 64 65 |or keybo|ard mode|
|000013b0| 2e 20 49 66 20 74 68 65 | 0a 20 20 20 20 6d 6f 75 |. If the|. mou|
|000013c0| 73 65 20 69 73 20 65 6e | 61 62 6c 65 64 2c 20 69 |se is en|abled, i|
|000013d0| 74 20 62 65 68 61 76 65 | 73 20 65 78 61 63 74 6c |t behave|s exactl|
|000013e0| 79 20 61 73 20 73 65 6c | 65 63 74 28 29 2e 0a 20 |y as sel|ect().. |
|000013f0| 0a 5c 66 75 6e 63 74 69 | 6f 6e 7b 76 6f 69 64 20 |.\functi|on{void |
|00001400| 73 65 74 43 75 72 72 65 | 6e 74 28 69 6e 74 20 69 |setCurre|nt(int i|
|00001410| 6e 64 65 78 29 7d 0a 20 | 20 20 20 52 65 73 65 74 |ndex)}. | Reset|
|00001420| 73 20 74 68 65 20 63 75 | 72 72 65 6e 74 20 28 64 |s the cu|rrent (d|
|00001430| 65 66 61 75 6c 74 29 20 | 63 68 6f 69 63 65 20 74 |efault) |choice t|
|00001440| 6f 20 74 68 65 20 63 68 | 6f 69 63 65 20 62 6f 78 |o the ch|oice box|
|00001450| 20 69 6e 64 69 63 61 74 | 65 64 20 62 79 0a 20 20 | indicat|ed by. |
|00001460| 20 20 22 69 6e 64 65 78 | 22 2e 20 20 54 68 65 20 | "index|". The |
|00001470| 64 65 66 61 75 6c 74 20 | 63 68 6f 69 63 65 20 69 |default |choice i|
|00001480| 73 0a 20 20 20 20 73 65 | 74 20 74 6f 20 74 68 65 |s. se|t to the|
|00001490| 20 66 69 72 73 74 20 63 | 68 6f 69 63 65 20 62 6f | first c|hoice bo|
|000014a0| 78 20 28 22 69 6e 64 65 | 78 22 20 24 3d 24 20 30 |x ("inde|x" $=$ 0|
|000014b0| 29 20 77 68 65 6e 20 61 | 20 63 68 6f 69 63 65 20 |) when a| choice |
|000014c0| 6f 62 6a 65 63 74 20 69 | 73 20 63 72 65 61 74 65 |object i|s create|
|000014d0| 64 2c 0a 20 20 20 20 6f | 72 20 74 68 65 20 63 68 |d,. o|r the ch|
|000014e0| 6f 69 63 65 20 73 65 6c | 65 63 74 65 64 20 6c 61 |oice sel|ected la|
|000014f0| 73 74 20 74 69 6d 65 2e | 20 20 54 68 69 73 20 63 |st time.| This c|
|00001500| 61 6c 6c 20 63 61 6e 0a | 20 20 20 20 63 68 61 6e |all can.| chan|
|00001510| 67 65 20 74 68 65 20 64 | 65 66 61 75 6c 74 20 63 |ge the d|efault c|
|00001520| 68 6f 69 63 65 20 77 69 | 74 68 6f 75 74 20 68 61 |hoice wi|thout ha|
|00001530| 76 69 6e 67 20 74 6f 20 | 73 65 6c 65 63 74 20 61 |ving to |select a|
|00001540| 6e 79 74 68 69 6e 67 20 | 66 69 72 73 74 2e 20 20 |nything |first. |
|00001550| 49 74 20 77 69 6c 6c 0a | 20 20 20 20 61 66 66 65 |It will.| affe|
|00001560| 63 74 20 74 68 65 20 62 | 65 68 61 76 69 6f 72 20 |ct the b|ehavior |
|00001570| 6f 66 20 61 20 73 65 6c | 65 63 74 4e 65 78 74 28 |of a sel|ectNext(|
|00001580| 29 20 63 61 6c 6c 2e 0a | 20 0a 5c 66 75 6e 63 74 |) call..| .\funct|
|00001590| 69 6f 6e 7b 76 6f 69 64 | 20 72 65 73 65 74 28 29 |ion{void| reset()|
|000015a0| 7d 0a 20 20 20 20 45 72 | 61 73 65 73 20 74 68 65 |}. Er|ases the|
|000015b0| 20 64 65 66 61 75 6c 74 | 20 63 68 6f 69 63 65 20 | default| choice |
|000015c0| 61 6e 64 20 72 65 73 65 | 74 73 20 74 68 65 20 69 |and rese|ts the i|
|000015d0| 6e 74 65 72 6e 61 6c 20 | 70 6f 69 6e 74 65 72 73 |nternal |pointers|
|000015e0| 20 61 73 20 69 66 20 74 | 68 69 73 0a 20 20 20 20 | as if t|his. |
|000015f0| 63 68 6f 69 63 65 20 6f | 62 6a 65 63 74 20 68 61 |choice o|bject ha|
|00001600| 64 20 6e 65 76 65 72 20 | 62 65 65 6e 20 73 65 6c |d never |been sel|
|00001610| 65 63 74 65 64 20 62 65 | 66 6f 72 65 2e 0a 20 0a |ected be|fore.. .|
|00001620| 5c 73 75 62 74 69 74 6c | 65 7b 56 69 72 74 75 61 |\subtitl|e{Virtua|
|00001630| 6c 20 5c 5c 20 4f 70 65 | 72 61 74 69 6f 6e 73 7d |l \\ Ope|rations}|
|00001640| 0a 20 0a 5c 66 75 6e 63 | 74 69 6f 6e 7b 76 6f 69 |. .\func|tion{voi|
|00001650| 64 20 61 63 74 69 6f 6e | 28 69 6e 74 20 73 74 61 |d action|(int sta|
|00001660| 74 75 73 29 7d 0a 20 20 | 20 20 44 65 66 69 6e 65 |tus)}. | Define|
|00001670| 73 20 74 68 65 20 62 65 | 68 61 76 69 6f 72 73 20 |s the be|haviors |
|00001680| 6f 66 20 74 68 65 20 63 | 68 6f 69 63 65 20 6f 62 |of the c|hoice ob|
|00001690| 6a 65 63 74 20 77 68 65 | 6e 20 61 20 63 68 6f 69 |ject whe|n a choi|
|000016a0| 63 65 20 68 61 6e 64 6c | 65 72 0a 20 20 20 20 68 |ce handl|er. h|
|000016b0| 61 73 20 62 65 65 6e 20 | 62 6f 6e 64 65 64 20 74 |as been |bonded t|
|000016c0| 6f 20 74 68 65 20 6f 62 | 6a 65 63 74 2e 20 20 54 |o the ob|ject. T|
|000016d0| 68 69 73 20 66 75 6e 63 | 74 69 6f 6e 20 69 73 20 |his func|tion is |
|000016e0| 63 61 6c 6c 65 64 20 62 | 79 20 74 68 65 0a 20 20 |called b|y the. |
|000016f0| 20 20 65 76 65 6e 74 20 | 68 61 6e 64 6c 65 72 20 | event |handler |
|00001700| 77 68 65 6e 20 69 74 20 | 64 65 74 65 63 74 73 20 |when it |detects |
|00001710| 74 68 61 74 20 74 68 65 | 20 63 68 6f 69 63 65 20 |that the| choice |
|00001720| 6f 62 6a 65 63 74 20 68 | 61 73 20 62 65 65 6e 0a |object h|as been.|
|00001730| 20 20 20 20 73 65 6c 65 | 63 74 65 64 2e 20 20 54 | sele|cted. T|
|00001740| 68 65 20 64 65 66 61 75 | 6c 74 20 61 63 74 69 6f |he defau|lt actio|
|00001750| 6e 20 69 73 20 74 6f 20 | 64 6f 20 6e 6f 74 68 69 |n is to |do nothi|
|00001760| 6e 67 20 69 66 20 6e 6f | 20 63 68 6f 69 63 65 20 |ng if no| choice |
|00001770| 68 61 6e 64 6c 65 72 0a | 20 20 20 20 70 72 65 73 |handler.| pres|
|00001780| 65 6e 74 73 2c 20 6f 74 | 68 65 72 77 69 73 65 2c |ents, ot|herwise,|
|00001790| 20 69 74 20 69 6e 76 6f | 6b 65 73 20 74 68 65 20 | it invo|kes the |
|000017a0| 63 68 6f 69 63 65 20 68 | 61 6e 64 6c 65 72 20 0a |choice h|andler .|
|000017b0| 20 20 20 20 61 6e 64 20 | 70 61 73 73 65 73 20 69 | and |passes i|
|000017c0| 74 20 61 6c 6f 6e 67 20 | 77 69 74 68 20 74 68 65 |t along |with the|
|000017d0| 20 63 75 72 72 65 6e 74 | 20 73 74 61 74 75 73 20 | current| status |
|000017e0| 0a 20 20 20 20 28 77 68 | 61 74 65 76 65 72 20 68 |. (wh|atever h|
|000017f0| 61 73 20 62 65 65 6e 20 | 72 65 74 75 72 6e 65 64 |as been |returned|
|00001800| 20 66 72 6f 6d 20 61 20 | 73 74 61 74 75 73 28 29 | from a |status()|
|00001810| 20 63 61 6c 6c 29 2e 20 | 20 0a 20 20 20 20 44 6f | call). | . Do|
|00001820| 20 6e 6f 74 20 6d 6f 64 | 69 66 79 20 74 68 69 73 | not mod|ify this|
|00001830| 20 66 75 6e 63 74 69 6f | 6e 20 75 6e 6c 65 73 73 | functio|n unless|
|00001840| 20 69 74 20 69 73 20 61 | 62 73 6f 6c 75 74 65 6c | it is a|bsolutel|
|00001850| 79 20 6e 65 63 65 73 73 | 61 72 79 20 62 65 63 61 |y necess|ary beca|
|00001860| 75 73 65 0a 20 20 20 20 | 69 74 20 72 65 64 65 66 |use. |it redef|
|00001870| 69 6e 65 73 20 74 68 65 | 20 73 65 6d 61 74 69 63 |ines the| sematic|
|00001880| 73 20 6f 66 20 61 6c 6c | 20 63 68 6f 69 63 65 20 |s of all| choice |
|00001890| 6f 62 6a 65 63 74 73 2e | 0a 20 0a 5c 66 75 6e 63 |objects.|. .\func|
|000018a0| 74 69 6f 6e 7b 76 6f 69 | 64 20 62 69 6e 64 28 76 |tion{voi|d bind(v|
|000018b0| 6f 69 64 20 5c 68 62 6f | 78 7b 5c 72 6d 20 28 5c |oid \hbo|x{\rm (\|
|000018c0| 2a 7b 5c 69 74 20 68 61 | 6e 64 6c 65 72 7d 29 28 |*{\it ha|ndler})(|
|000018d0| 69 6e 74 29 7d 29 7d 0a | 20 20 20 20 41 73 73 6f |int)})}.| Asso|
|000018e0| 63 69 61 74 65 73 20 61 | 20 63 68 6f 69 63 65 20 |ciates a| choice |
|000018f0| 68 61 6e 64 6c 65 72 20 | 66 75 6e 63 74 69 6f 6e |handler |function|
|00001900| 20 77 69 74 68 20 74 68 | 65 20 63 68 6f 69 63 65 | with th|e choice|
|00001910| 20 6f 62 6a 65 63 74 2e | 20 20 45 76 65 72 79 0a | object.| Every.|
|00001920| 20 20 20 20 74 69 6d 65 | 20 74 68 69 73 20 63 68 | time| this ch|
|00001930| 6f 69 63 65 20 6f 62 6a | 65 63 74 20 69 73 20 69 |oice obj|ect is i|
|00001940| 6e 76 6f 6b 65 64 2c 20 | 74 68 65 20 63 68 6f 69 |nvoked, |the choi|
|00001950| 63 65 20 68 61 6e 64 6c | 65 72 20 69 73 20 63 61 |ce handl|er is ca|
|00001960| 6c 6c 65 64 0a 20 20 20 | 20 69 6d 6d 65 64 69 61 |lled. | immedia|
|00001970| 74 65 6c 79 2e 20 20 0a | 20 20 20 20 54 68 65 20 |tely. .| The |
|00001980| 68 61 6e 64 6c 65 72 20 | 69 73 20 70 61 73 73 65 |handler |is passe|
|00001990| 64 20 61 6c 6f 6e 67 20 | 77 69 74 68 20 74 68 65 |d along |with the|
|000019a0| 20 63 75 72 72 65 6e 74 | 20 22 73 74 61 74 75 73 | current| "status|
|000019b0| 22 0a 20 20 20 20 28 72 | 65 74 75 72 6e 20 76 61 |". (r|eturn va|
|000019c0| 6c 75 65 20 6f 66 20 73 | 74 61 74 75 73 28 29 20 |lue of s|tatus() |
|000019d0| 63 61 6c 6c 29 20 61 73 | 20 69 74 73 20 61 72 67 |call) as| its arg|
|000019e0| 75 6d 65 6e 74 2e 20 54 | 68 65 20 64 65 66 61 75 |ument. T|he defau|
|000019f0| 6c 74 20 0a 20 20 20 20 | 61 63 74 69 6f 6e 20 74 |lt . |action t|
|00001a00| 61 6b 65 6e 20 62 79 20 | 74 68 65 20 65 76 65 6e |aken by |the even|
|00001a10| 74 20 68 61 6e 64 6c 65 | 72 20 63 61 6e 20 62 65 |t handle|r can be|
|00001a20| 20 6d 6f 64 69 66 69 65 | 64 20 62 79 20 63 68 61 | modifie|d by cha|
|00001a30| 6e 67 69 6e 67 0a 20 20 | 20 20 74 68 65 20 6e 65 |nging. | the ne|
|00001a40| 78 74 20 66 75 6e 63 74 | 69 6f 6e 20 61 63 74 69 |xt funct|ion acti|
|00001a50| 6f 6e 28 29 2e 0a 20 0a | 5c 66 75 6e 63 74 69 6f |on().. .|\functio|
|00001a60| 6e 7b 42 6f 6f 6c 65 61 | 6e 20 69 73 53 65 6c 65 |n{Boolea|n isSele|
|00001a70| 63 74 65 64 28 50 6f 69 | 6e 74 20 63 75 72 73 6f |cted(Poi|nt curso|
|00001a80| 72 29 7d 0a 20 20 20 20 | 52 65 74 75 72 6e 73 20 |r)}. |Returns |
|00001a90| 54 52 55 45 20 69 66 20 | 61 20 6c 65 67 61 6c 20 |TRUE if |a legal |
|00001aa0| 68 6f 74 20 6b 65 79 20 | 69 73 20 70 72 65 73 73 |hot key |is press|
|00001ab0| 65 64 20 66 6f 72 20 74 | 68 65 0a 20 20 20 20 74 |ed for t|he. t|
|00001ac0| 68 65 20 69 6e 64 69 63 | 61 74 65 64 20 63 68 6f |he indic|ated cho|
|00001ad0| 69 63 65 20 6f 62 6a 65 | 63 74 2e 20 49 74 20 61 |ice obje|ct. It a|
|00001ae0| 6c 73 6f 20 72 65 74 75 | 72 6e 73 20 54 52 55 45 |lso retu|rns TRUE|
|00001af0| 20 69 66 20 0a 20 20 20 | 20 61 20 6d 6f 75 73 65 | if . | a mouse|
|00001b00| 20 62 75 74 74 6f 6e 20 | 69 73 20 70 72 65 73 73 | button |is press|
|00001b10| 65 64 20 77 69 74 68 69 | 6e 20 74 68 65 20 72 61 |ed withi|n the ra|
|00001b20| 6e 67 65 20 6f 66 20 74 | 68 65 20 63 68 6f 69 63 |nge of t|he choic|
|00001b30| 65 20 6f 62 6a 65 63 74 | 20 61 72 65 61 2e 0a 20 |e object| area.. |
|00001b40| 20 20 20 54 68 69 73 20 | 63 61 6c 6c 20 69 73 20 | This |call is |
|00001b50| 75 73 65 64 20 62 79 20 | 74 68 65 20 65 76 65 6e |used by |the even|
|00001b60| 74 20 68 61 6e 64 6c 65 | 72 20 74 6f 20 63 68 65 |t handle|r to che|
|00001b70| 63 6b 20 69 66 20 74 68 | 69 73 20 63 68 6f 69 63 |ck if th|is choic|
|00001b80| 65 20 6f 62 6a 65 63 74 | 0a 20 20 20 20 68 61 73 |e object|. has|
|00001b90| 20 62 65 65 6e 20 73 65 | 6c 65 63 74 65 64 2e 20 | been se|lected. |
|00001ba0| 20 49 74 20 69 73 20 68 | 61 72 64 6c 79 20 6e 65 | It is h|ardly ne|
|00001bb0| 65 64 65 64 20 69 6e 20 | 72 65 67 75 6c 61 72 20 |eded in |regular |
|00001bc0| 61 70 70 6c 69 63 61 74 | 69 6f 6e 73 2e 0a 20 20 |applicat|ions.. |
|00001bd0| 20 20 54 68 65 20 22 63 | 75 72 73 6f 72 22 20 69 | The "c|ursor" i|
|00001be0| 73 20 66 6f 72 20 6d 6f | 75 73 65 20 63 75 72 73 |s for mo|use curs|
|00001bf0| 6f 72 20 69 6e 20 6d 6f | 75 73 65 20 6d 6f 64 65 |or in mo|use mode|
|00001c00| 20 6f 72 20 66 61 6b 65 | 64 20 77 69 74 68 20 74 | or fake|d with t|
|00001c10| 68 65 0a 20 20 20 20 63 | 75 72 72 65 6e 74 20 6b |he. c|urrent k|
|00001c20| 65 79 62 6f 61 72 64 20 | 69 6e 70 75 74 20 61 73 |eyboard |input as|
|00001c30| 20 74 68 65 20 63 75 72 | 73 6f 72 27 73 20 78 20 | the cur|sor's x |
|00001c40| 63 6f 6f 72 64 69 6e 61 | 74 65 2e 0a 20 0a 5c 66 |coordina|te.. .\f|
|00001c50| 75 6e 63 74 69 6f 6e 7b | 69 6e 74 20 73 65 6c 65 |unction{|int sele|
|00001c60| 63 74 28 29 7d 0a 20 20 | 20 20 50 69 63 6b 73 20 |ct()}. | Picks |
|00001c70| 61 20 63 68 6f 69 63 65 | 20 66 72 6f 6d 20 74 68 |a choice| from th|
|00001c80| 65 20 63 68 6f 69 63 65 | 20 6f 62 6a 65 63 74 2e |e choice| object.|
|00001c90| 20 20 49 66 20 74 68 65 | 20 6d 6f 75 73 65 20 69 | If the| mouse i|
|00001ca0| 73 20 6e 6f 74 20 65 6e | 61 62 6c 65 64 2c 0a 20 |s not en|abled,. |
|00001cb0| 20 20 20 74 68 65 20 64 | 65 66 61 75 6c 74 20 63 | the d|efault c|
|00001cc0| 68 6f 69 63 65 20 28 74 | 68 65 20 6f 6e 65 20 70 |hoice (t|he one p|
|00001cd0| 69 63 6b 65 64 20 6c 61 | 73 74 20 74 69 6d 65 20 |icked la|st time |
|00001ce0| 6f 72 20 74 68 65 20 66 | 69 72 73 74 20 6f 6e 65 |or the f|irst one|
|00001cf0| 20 69 66 0a 20 20 20 20 | 74 68 69 73 20 69 73 20 | if. |this is |
|00001d00| 74 68 65 20 66 69 72 73 | 74 20 74 69 6d 65 20 74 |the firs|t time t|
|00001d10| 68 69 73 20 66 75 6e 63 | 74 69 6f 6e 20 69 73 20 |his func|tion is |
|00001d20| 63 61 6c 6c 65 64 29 20 | 69 73 20 64 69 73 70 6c |called) |is displ|
|00001d30| 61 79 65 64 20 69 6e 0a | 20 20 20 20 68 69 67 68 |ayed in.| high|
|00001d40| 6c 69 67 68 74 20 63 6f | 6c 6f 72 73 2e 20 54 68 |light co|lors. Th|
|00001d50| 65 20 61 72 72 6f 77 20 | 6b 65 79 20 63 61 6e 20 |e arrow |key can |
|00001d60| 62 65 20 75 73 65 64 20 | 74 6f 20 6d 6f 76 65 20 |be used |to move |
|00001d70| 74 68 65 20 0a 20 20 20 | 20 64 65 66 61 75 6c 74 |the . | default|
|00001d80| 20 63 68 6f 69 63 65 2e | 20 54 68 65 20 45 4e 54 | choice.| The ENT|
|00001d90| 45 52 20 6b 65 79 20 6d | 75 73 74 20 62 65 20 75 |ER key m|ust be u|
|00001da0| 73 65 64 20 74 6f 20 63 | 6f 6e 66 69 72 6d 20 74 |sed to c|onfirm t|
|00001db0| 68 65 20 73 65 6c 65 63 | 74 69 6f 6e 2e 20 20 0a |he selec|tion. .|
|00001dc0| 20 20 20 20 49 66 20 74 | 68 65 20 6d 6f 75 73 65 | If t|he mouse|
|00001dd0| 20 69 73 20 65 6e 61 62 | 6c 65 64 2c 0a 20 20 20 | is enab|led,. |
|00001de0| 20 74 68 69 73 20 63 61 | 6c 6c 20 63 68 65 63 6b | this ca|ll check|
|00001df0| 73 20 69 66 20 61 20 6d | 6f 75 73 65 20 62 75 74 |s if a m|ouse but|
|00001e00| 74 6f 6e 20 68 61 73 20 | 62 65 65 6e 20 70 72 65 |ton has |been pre|
|00001e10| 73 73 65 64 20 77 68 69 | 6c 65 20 74 68 65 20 6d |ssed whi|le the m|
|00001e20| 6f 75 73 65 0a 20 20 20 | 20 63 75 72 73 6f 72 20 |ouse. | cursor |
|00001e30| 69 73 20 69 6e 73 69 64 | 65 20 6f 6e 65 20 6f 66 |is insid|e one of|
|00001e40| 20 74 68 65 20 63 68 6f | 69 63 65 20 62 6f 78 65 | the cho|ice boxe|
|00001e50| 73 2e 20 54 68 65 20 72 | 65 74 75 72 6e 20 76 61 |s. The r|eturn va|
|00001e60| 6c 75 65 20 69 73 20 74 | 68 65 20 69 6e 64 65 78 |lue is t|he index|
|00001e70| 20 0a 20 20 20 20 6f 66 | 20 74 68 65 20 63 68 6f | . of| the cho|
|00001e80| 69 63 65 20 62 6f 78 20 | 73 65 6c 65 63 74 65 64 |ice box |selected|
|00001e90| 2e 20 0a 20 20 20 20 41 | 20 45 53 43 20 6b 65 79 |. . A| ESC key|
|00001ea0| 20 6d 61 79 20 62 65 20 | 70 72 65 73 73 65 64 0a | may be |pressed.|
|00001eb0| 20 20 20 20 74 6f 20 6c | 65 61 76 65 20 74 68 65 | to l|eave the|
|00001ec0| 20 63 75 72 72 65 6e 74 | 20 73 65 6c 65 63 74 28 | current| select(|
|00001ed0| 29 20 63 61 6c 6c 20 77 | 69 74 68 6f 75 74 20 61 |) call w|ithout a|
|00001ee0| 63 74 75 61 6c 6c 79 20 | 73 65 6c 65 63 74 69 6e |ctually |selectin|
|00001ef0| 67 20 61 6e 79 74 68 69 | 6e 67 2e 0a 20 20 20 20 |g anythi|ng.. |
|00001f00| 49 6e 20 74 68 69 73 20 | 63 61 73 65 2c 20 24 2d |In this |case, $-|
|00001f10| 31 24 20 77 69 6c 6c 20 | 62 65 20 72 65 74 75 72 |1$ will |be retur|
|00001f20| 6e 65 64 2e 20 20 0a 20 | 20 20 20 4e 6f 74 65 3a |ned. . | Note:|
|00001f30| 20 57 69 74 68 20 6e 6f | 20 6d 6f 75 73 65 20 65 | With no| mouse e|
|00001f40| 6e 61 62 6c 65 64 2c 0a | 20 20 20 20 73 65 6c 65 |nabled,.| sele|
|00001f50| 63 74 28 29 20 77 61 69 | 74 73 20 66 6f 72 20 65 |ct() wai|ts for e|
|00001f60| 69 74 68 65 72 20 61 6e | 20 45 6e 74 65 72 20 6b |ither an| Enter k|
|00001f70| 65 79 20 6f 72 20 45 53 | 43 20 6b 65 79 20 74 6f |ey or ES|C key to|
|00001f80| 20 72 65 74 75 72 6e 2c | 20 20 77 68 65 72 65 61 | return,| wherea|
|00001f90| 73 0a 20 20 20 20 77 69 | 74 68 20 74 68 65 20 6d |s. wi|th the m|
|00001fa0| 6f 75 73 65 20 65 6e 61 | 62 6c 65 64 2c 20 74 68 |ouse ena|bled, th|
|00001fb0| 65 20 72 65 74 75 72 6e | 20 69 73 20 69 6d 6d 65 |e return| is imme|
|00001fc0| 64 69 61 74 65 2e 0a 20 | 0a 5c 66 75 6e 63 74 69 |diate.. |.\functi|
|00001fd0| 6f 6e 7b 69 6e 74 20 73 | 74 61 74 75 73 28 29 7d |on{int s|tatus()}|
|00001fe0| 0a 20 20 20 20 52 65 74 | 75 72 6e 73 20 74 68 65 |. Ret|urns the|
|00001ff0| 20 63 75 72 72 65 6e 74 | 20 63 68 6f 69 63 65 20 | current| choice |
|00002000| 69 6e 64 65 78 20 28 74 | 68 65 20 6f 6e 65 20 69 |index (t|he one i|
|00002010| 6e 20 72 65 76 65 72 73 | 65 20 63 6f 6c 6f 72 20 |n revers|e color |
|00002020| 6f 6e 20 74 68 65 20 73 | 63 72 65 65 6e 29 2e 0a |on the s|creen)..|
|00002030| 20 20 20 20 49 66 20 74 | 68 65 72 65 20 69 73 20 | If t|here is |
|00002040| 6e 6f 20 63 75 72 72 65 | 6e 74 20 63 68 6f 69 63 |no curre|nt choic|
|00002050| 65 20 28 65 69 74 68 65 | 72 20 69 74 20 68 61 73 |e (eithe|r it has|
|00002060| 20 6e 6f 74 20 62 65 65 | 6e 20 73 65 6c 65 63 74 | not bee|n select|
|00002070| 65 64 20 6f 72 20 68 61 | 73 0a 20 20 20 20 62 65 |ed or ha|s. be|
|00002080| 65 6e 20 72 65 73 65 74 | 29 20 74 68 65 20 72 65 |en reset|) the re|
|00002090| 74 75 72 6e 20 76 61 6c | 75 65 20 69 73 20 24 2d |turn val|ue is $-|
|000020a0| 31 24 2e 0a 20 0a 5c 73 | 75 62 74 69 74 6c 65 7b |1$.. .\s|ubtitle{|
|000020b0| 53 65 65 20 41 6c 73 6f | 7d 0a 20 20 20 20 20 45 |See Also|}. E|
|000020c0| 76 65 6e 74 2c 20 42 75 | 74 74 6f 6e 2c 20 42 6f |vent, Bu|tton, Bo|
|000020d0| 78 0a 20 0a 5c 73 75 62 | 74 69 74 6c 65 7b 41 75 |x. .\sub|title{Au|
|000020e0| 74 68 6f 72 7d 0a 20 20 | 20 20 52 6f 6e 20 43 68 |thor}. | Ron Ch|
|000020f0| 65 6e 20 61 74 20 74 68 | 65 20 4f 66 66 69 63 65 |en at th|e Office|
|00002100| 20 66 6f 72 20 49 6e 66 | 6f 72 6d 61 74 69 6f 6e | for Inf|ormation|
|00002110| 20 4d 61 6e 61 67 65 6d | 65 6e 74 2c 20 55 49 55 | Managem|ent, UIU|
|00002120| 43 2e 20 39 2d 31 2d 38 | 39 2e 0a 20 0a 5c 65 6e |C. 9-1-8|9.. .\en|
|00002130| 64 7b 6d 61 6e 70 61 67 | 65 7d 0a 5c 6e 65 77 70 |d{manpag|e}.\newp|
|00002140| 61 67 65 0a 5c 62 65 67 | 69 6e 7b 76 65 72 62 61 |age.\beg|in{verba|
|00002150| 74 69 6d 7d 0a 20 20 20 | 20 2f 2a 20 45 58 41 4d |tim}. | /* EXAM|
|00002160| 50 4c 45 20 31 20 2a 2f | 0a 20 20 20 20 23 69 6e |PLE 1 */|. #in|
|00002170| 63 6c 75 64 65 20 3c 73 | 74 64 6c 69 62 2e 68 3e |clude <s|tdlib.h>|
|00002180| 0a 20 20 20 20 23 69 6e | 63 6c 75 64 65 20 22 63 |. #in|clude "c|
|00002190| 68 6f 69 63 65 2e 68 22 | 0a 20 0a 20 20 20 20 76 |hoice.h"|. . v|
|000021a0| 6f 69 64 20 68 61 6e 64 | 6c 65 72 31 28 69 6e 74 |oid hand|ler1(int|
|000021b0| 20 63 68 6f 69 63 65 29 | 20 7b 0a 20 20 20 20 20 | choice)| {. |
|000021c0| 20 20 20 42 6f 78 20 62 | 6f 78 28 35 30 30 2c 20 | Box b|ox(500, |
|000021d0| 33 30 2c 20 36 30 30 2c | 20 36 30 2c 20 4c 49 47 |30, 600,| 60, LIG|
|000021e0| 48 54 5f 43 59 41 4e 2c | 20 4c 49 47 48 54 5f 4d |HT_CYAN,| LIGHT_M|
|000021f0| 41 47 45 4e 54 41 29 3b | 0a 20 20 20 20 20 20 20 |AGENTA);|. |
|00002200| 20 62 6f 78 20 3c 3c 20 | 63 68 6f 69 63 65 20 2b | box << |choice +|
|00002210| 20 31 3b 0a 20 20 20 20 | 7d 0a 20 0a 20 20 20 20 | 1;. |}. . |
|00002220| 76 6f 69 64 20 68 61 6e | 64 6c 65 72 32 28 69 6e |void han|dler2(in|
|00002230| 74 20 63 68 6f 69 63 65 | 29 20 7b 0a 20 20 20 20 |t choice|) {. |
|00002240| 20 20 20 20 42 6f 78 20 | 62 6f 78 28 35 30 30 2c | Box |box(500,|
|00002250| 20 33 30 2c 20 36 30 30 | 2c 20 36 30 2c 20 4c 49 | 30, 600|, 60, LI|
|00002260| 47 48 54 5f 43 59 41 4e | 2c 20 4c 49 47 48 54 5f |GHT_CYAN|, LIGHT_|
|00002270| 4d 41 47 45 4e 54 41 29 | 3b 0a 20 20 20 20 20 20 |MAGENTA)|;. |
|00002280| 20 20 62 6f 78 20 3c 3c | 20 28 63 68 6f 69 63 65 | box <<| (choice|
|00002290| 3d 3d 30 20 3f 20 22 41 | 70 65 22 20 3a 20 28 63 |==0 ? "A|pe" : (c|
|000022a0| 68 6f 69 63 65 3d 3d 31 | 20 3f 20 22 42 6f 62 22 |hoice==1| ? "Bob"|
|000022b0| 20 3a 20 22 43 61 72 22 | 29 29 3b 0a 20 20 20 20 | : "Car"|));. |
|000022c0| 7d 0a 20 0a 20 20 20 20 | 76 6f 69 64 20 68 61 6e |}. . |void han|
|000022d0| 64 6c 65 72 33 28 69 6e | 74 20 63 68 6f 69 63 65 |dler3(in|t choice|
|000022e0| 29 20 7b 0a 20 20 20 20 | 20 20 20 20 42 6f 78 20 |) {. | Box |
|000022f0| 62 6f 78 28 35 30 30 2c | 20 33 30 2c 20 36 30 30 |box(500,| 30, 600|
|00002300| 2c 20 36 30 2c 20 4c 49 | 47 48 54 5f 43 59 41 4e |, 60, LI|GHT_CYAN|
|00002310| 2c 20 4c 49 47 48 54 5f | 4d 41 47 45 4e 54 41 29 |, LIGHT_|MAGENTA)|
|00002320| 3b 0a 20 20 20 20 20 20 | 20 20 73 77 69 74 63 68 |;. | switch|
|00002330| 20 28 63 68 6f 69 63 65 | 29 20 7b 0a 20 20 20 20 | (choice|) {. |
|00002340| 20 20 20 20 20 20 20 20 | 63 61 73 65 20 30 3a 20 | |case 0: |
|00002350| 62 6f 78 20 3c 3c 20 22 | 44 22 3b 20 62 72 65 61 |box << "|D"; brea|
|00002360| 6b 3b 20 63 61 73 65 20 | 31 3a 20 62 6f 78 20 3c |k; case |1: box <|
|00002370| 3c 20 22 45 22 3b 20 62 | 72 65 61 6b 3b 0a 20 20 |< "E"; b|reak;. |
|00002380| 20 20 20 20 20 20 20 20 | 20 20 63 61 73 65 20 32 | | case 2|
|00002390| 3a 20 62 6f 78 20 3c 3c | 20 22 46 22 3b 20 62 72 |: box <<| "F"; br|
|000023a0| 65 61 6b 3b 20 63 61 73 | 65 20 33 3a 20 62 6f 78 |eak; cas|e 3: box|
|000023b0| 20 3c 3c 20 22 47 22 3b | 20 62 72 65 61 6b 3b 0a | << "G";| break;.|
|000023c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 63 61 73 65 | | case|
|000023d0| 20 34 3a 20 65 78 69 74 | 28 30 29 3b 0a 20 20 20 | 4: exit|(0);. |
|000023e0| 20 20 20 20 20 7d 0a 20 | 20 20 20 7d 0a 20 0a 20 | }. | }. . |
|000023f0| 20 20 20 6d 61 69 6e 28 | 29 20 7b 0a 20 20 20 20 | main(|) {. |
|00002400| 20 20 20 20 50 6f 69 6e | 74 20 61 28 31 30 30 2c | Poin|t a(100,|
|00002410| 20 31 30 30 29 2c 20 62 | 28 32 32 30 2c 20 31 33 | 100), b|(220, 13|
|00002420| 30 29 3b 0a 20 20 20 20 | 20 20 20 20 43 68 6f 69 |0);. | Choi|
|00002430| 63 65 20 63 31 28 61 2c | 62 2c 42 52 4f 57 4e 2c |ce c1(a,|b,BROWN,|
|00002440| 52 45 44 2c 4f 4e 5f 42 | 4f 52 44 45 52 2c 30 2c |RED,ON_B|ORDER,0,|
|00002450| 34 2c 22 40 31 40 22 2c | 22 40 32 40 22 2c 22 40 |4,"@1@",|"@2@","@|
|00002460| 33 40 22 2c 22 40 34 40 | 22 29 3b 0a 20 0a 20 20 |3@","@4@|");. . |
|00002470| 20 20 20 20 20 20 61 20 | 3d 20 50 6f 69 6e 74 28 | a |= Point(|
|00002480| 32 30 30 2c 20 32 30 30 | 29 3b 20 62 20 3d 20 50 |200, 200|); b = P|
|00002490| 6f 69 6e 74 28 34 30 30 | 2c 20 32 33 30 29 3b 0a |oint(400|, 230);.|
|000024a0| 20 20 20 20 20 20 20 20 | 43 68 6f 69 63 65 20 63 | |Choice c|
|000024b0| 32 28 61 2c 62 2c 57 48 | 49 54 45 2c 42 4c 55 45 |2(a,b,WH|ITE,BLUE|
|000024c0| 2c 49 4e 5f 42 4f 52 44 | 45 52 2c 31 30 2c 33 2c |,IN_BORD|ER,10,3,|
|000024d0| 22 40 41 40 70 65 22 2c | 22 40 42 40 6f 62 22 2c |"@A@pe",|"@B@ob",|
|000024e0| 22 40 43 40 61 72 22 29 | 3b 0a 20 0a 20 20 20 20 |"@C@ar")|;. . |
|000024f0| 20 20 20 20 61 20 3d 20 | 50 6f 69 6e 74 28 35 30 | a = |Point(50|
|00002500| 30 2c 20 32 33 30 29 3b | 20 62 20 3d 20 50 6f 69 |0, 230);| b = Poi|
|00002510| 6e 74 28 35 35 30 2c 20 | 33 33 30 29 3b 0a 20 20 |nt(550, |330);. |
|00002520| 20 20 20 20 20 20 43 68 | 6f 69 63 65 20 63 33 28 | Ch|oice c3(|
|00002530| 61 2c 62 2c 47 52 45 45 | 4e 2c 47 52 41 59 2c 4e |a,b,GREE|N,GRAY,N|
|00002540| 4f 5f 42 4f 52 44 45 52 | 2c 31 30 2c 35 2c 22 40 |O_BORDER|,10,5,"@|
|00002550| 44 40 22 2c 22 40 45 40 | 22 2c 22 40 46 40 22 2c |D@","@E@|","@F@",|
|00002560| 22 40 47 40 22 2c 22 40 | 48 40 22 29 3b 0a 20 0a |"@G@","@|H@");. .|
|00002570| 20 20 20 20 20 20 20 20 | 66 6f 72 20 28 69 6e 74 | |for (int|
|00002580| 20 70 69 63 6b 3b 3b 29 | 20 7b 0a 20 20 20 20 20 | pick;;)| {. |
|00002590| 20 20 20 20 20 20 20 69 | 66 20 28 28 70 69 63 6b | i|f ((pick|
|000025a0| 20 3d 20 63 31 2e 73 65 | 6c 65 63 74 28 29 29 20 | = c1.se|lect()) |
|000025b0| 21 3d 20 2d 31 29 20 68 | 61 6e 64 6c 65 72 31 28 |!= -1) h|andler1(|
|000025c0| 70 69 63 6b 29 3b 0a 20 | 20 20 20 20 20 20 20 20 |pick);. | |
|000025d0| 20 20 20 69 66 20 28 28 | 70 69 63 6b 20 3d 20 63 | if ((|pick = c|
|000025e0| 32 2e 73 65 6c 65 63 74 | 28 29 29 20 21 3d 20 2d |2.select|()) != -|
|000025f0| 31 29 20 68 61 6e 64 6c | 65 72 32 28 70 69 63 6b |1) handl|er2(pick|
|00002600| 29 3b 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 69 |);. | i|
|00002610| 66 20 28 28 70 69 63 6b | 20 3d 20 63 33 2e 73 65 |f ((pick| = c3.se|
|00002620| 6c 65 63 74 28 29 29 20 | 21 3d 20 2d 31 29 20 68 |lect()) |!= -1) h|
|00002630| 61 6e 64 6c 65 72 33 28 | 70 69 63 6b 29 3b 0a 20 |andler3(|pick);. |
|00002640| 20 20 20 20 20 20 20 7d | 0a 20 20 20 20 7d 0a 5c | }|. }.\|
|00002650| 65 6e 64 7b 76 65 72 62 | 61 74 69 6d 7d 0a 5c 6e |end{verb|atim}.\n|
|00002660| 65 77 70 61 67 65 0a 5c | 62 65 67 69 6e 7b 76 65 |ewpage.\|begin{ve|
|00002670| 72 62 61 74 69 6d 7d 0a | 20 20 20 20 2f 2a 20 45 |rbatim}.| /* E|
|00002680| 58 41 4d 50 4c 45 20 32 | 20 2a 2f 0a 20 20 20 20 |XAMPLE 2| */. |
|00002690| 23 69 6e 63 6c 75 64 65 | 20 3c 73 74 64 6c 69 62 |#include| <stdlib|
|000026a0| 2e 68 3e 0a 20 20 20 20 | 23 69 6e 63 6c 75 64 65 |.h>. |#include|
|000026b0| 20 22 63 68 6f 69 63 65 | 2e 68 22 0a 20 0a 20 20 | "choice|.h". . |
|000026c0| 20 20 76 6f 69 64 20 68 | 61 6e 64 6c 65 72 31 28 | void h|andler1(|
|000026d0| 69 6e 74 20 70 69 63 6b | 29 20 7b 0a 20 20 20 20 |int pick|) {. |
|000026e0| 20 20 20 20 42 6f 78 20 | 62 6f 78 28 35 30 30 2c | Box |box(500,|
|000026f0| 20 33 30 2c 20 36 30 30 | 2c 20 36 30 2c 20 4c 49 | 30, 600|, 60, LI|
|00002700| 47 48 54 5f 43 59 41 4e | 2c 20 4c 49 47 48 54 5f |GHT_CYAN|, LIGHT_|
|00002710| 4d 41 47 45 4e 54 41 29 | 3b 0a 20 20 20 20 20 20 |MAGENTA)|;. |
|00002720| 20 20 62 6f 78 20 3c 3c | 20 70 69 63 6b 20 2b 20 | box <<| pick + |
|00002730| 31 3b 0a 20 20 20 20 7d | 0a 20 0a 20 20 20 20 76 |1;. }|. . v|
|00002740| 6f 69 64 20 68 61 6e 64 | 6c 65 72 32 28 69 6e 74 |oid hand|ler2(int|
|00002750| 20 70 69 63 6b 29 20 7b | 0a 20 20 20 20 20 20 20 | pick) {|. |
|00002760| 20 42 6f 78 20 62 6f 78 | 28 35 30 30 2c 20 33 30 | Box box|(500, 30|
|00002770| 2c 20 36 30 30 2c 20 36 | 30 2c 20 4c 49 47 48 54 |, 600, 6|0, LIGHT|
|00002780| 5f 43 59 41 4e 2c 20 4c | 49 47 48 54 5f 4d 41 47 |_CYAN, L|IGHT_MAG|
|00002790| 45 4e 54 41 29 3b 0a 20 | 20 20 20 20 20 20 20 62 |ENTA);. | b|
|000027a0| 6f 78 20 3c 3c 20 28 70 | 69 63 6b 3d 3d 30 20 3f |ox << (p|ick==0 ?|
|000027b0| 20 22 41 70 65 22 20 3a | 20 28 70 69 63 6b 3d 3d | "Ape" :| (pick==|
|000027c0| 31 20 3f 20 22 42 6f 62 | 22 20 3a 20 22 43 61 72 |1 ? "Bob|" : "Car|
|000027d0| 22 29 29 3b 0a 20 20 20 | 20 7d 0a 20 0a 20 20 20 |"));. | }. . |
|000027e0| 20 76 6f 69 64 20 68 61 | 6e 64 6c 65 72 33 28 69 | void ha|ndler3(i|
|000027f0| 6e 74 20 70 69 63 6b 29 | 20 7b 0a 20 20 20 20 20 |nt pick)| {. |
|00002800| 20 20 20 42 6f 78 20 62 | 6f 78 28 35 30 30 2c 20 | Box b|ox(500, |
|00002810| 33 30 2c 20 36 30 30 2c | 20 36 30 2c 20 4c 49 47 |30, 600,| 60, LIG|
|00002820| 48 54 5f 43 59 41 4e 2c | 20 4c 49 47 48 54 5f 4d |HT_CYAN,| LIGHT_M|
|00002830| 41 47 45 4e 54 41 29 3b | 0a 20 20 20 20 20 20 20 |AGENTA);|. |
|00002840| 20 73 77 69 74 63 68 20 | 28 70 69 63 6b 29 20 7b | switch |(pick) {|
|00002850| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 63 61 73 |. | cas|
|00002860| 65 20 30 3a 20 62 6f 78 | 20 3c 3c 20 22 44 22 3b |e 0: box| << "D";|
|00002870| 20 62 72 65 61 6b 3b 20 | 63 61 73 65 20 31 3a 20 | break; |case 1: |
|00002880| 62 6f 78 20 3c 3c 20 22 | 45 22 3b 20 62 72 65 61 |box << "|E"; brea|
|00002890| 6b 3b 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 63 |k;. | c|
|000028a0| 61 73 65 20 32 3a 20 62 | 6f 78 20 3c 3c 20 22 46 |ase 2: b|ox << "F|
|000028b0| 22 3b 20 62 72 65 61 6b | 3b 20 63 61 73 65 20 33 |"; break|; case 3|
|000028c0| 3a 20 62 6f 78 20 3c 3c | 20 22 47 22 3b 20 62 72 |: box <<| "G"; br|
|000028d0| 65 61 6b 3b 0a 20 20 20 | 20 20 20 20 20 20 20 20 |eak;. | |
|000028e0| 20 63 61 73 65 20 34 3a | 20 65 78 69 74 28 30 29 | case 4:| exit(0)|
|000028f0| 3b 0a 20 20 20 20 20 20 | 20 20 7d 0a 20 20 20 20 |;. | }. |
|00002900| 7d 0a 20 0a 20 20 20 20 | 6d 61 69 6e 28 29 20 7b |}. . |main() {|
|00002910| 0a 20 20 20 20 20 20 20 | 20 50 6f 69 6e 74 20 61 |. | Point a|
|00002920| 28 31 30 30 2c 20 31 30 | 30 29 2c 20 62 28 32 32 |(100, 10|0), b(22|
|00002930| 30 2c 20 31 33 30 29 3b | 0a 20 20 20 20 20 20 20 |0, 130);|. |
|00002940| 20 43 68 6f 69 63 65 20 | 63 31 28 61 2c 62 2c 42 | Choice |c1(a,b,B|
|00002950| 52 4f 57 4e 2c 52 45 44 | 2c 4f 4e 5f 42 4f 52 44 |ROWN,RED|,ON_BORD|
|00002960| 45 52 2c 30 2c 34 2c 22 | 40 31 40 22 2c 22 40 32 |ER,0,4,"|@1@","@2|
|00002970| 40 22 2c 22 40 33 40 22 | 2c 22 40 34 40 22 29 3b |@","@3@"|,"@4@");|
|00002980| 0a 20 20 20 20 20 20 20 | 20 43 68 6f 69 63 65 20 |. | Choice |
|00002990| 63 32 28 33 2c 20 48 4f | 52 49 5a 4f 4e 54 41 4c |c2(3, HO|RIZONTAL|
|000029a0| 29 3b 0a 20 20 20 20 20 | 20 20 20 63 32 2e 61 64 |);. | c2.ad|
|000029b0| 64 49 74 65 6d 28 50 6f | 69 6e 74 28 32 30 30 2c |dItem(Po|int(200,|
|000029c0| 20 32 30 30 29 2c 20 50 | 6f 69 6e 74 28 32 36 30 | 200), P|oint(260|
|000029d0| 2c 32 33 30 29 2c 0a 20 | 20 20 20 20 20 20 20 20 |,230),. | |
|000029e0| 20 20 20 20 20 20 20 20 | 20 20 57 48 49 54 45 2c | | WHITE,|
|000029f0| 20 42 4c 55 45 2c 20 49 | 4e 5f 42 4f 52 44 45 52 | BLUE, I|N_BORDER|
|00002a00| 2c 20 22 40 41 40 70 65 | 22 29 3b 0a 20 20 20 20 |, "@A@pe|");. |
|00002a10| 20 20 20 20 63 32 2e 61 | 64 64 49 74 65 6d 28 50 | c2.a|ddItem(P|
|00002a20| 6f 69 6e 74 28 32 37 30 | 2c 20 32 30 30 29 2c 20 |oint(270|, 200), |
|00002a30| 50 6f 69 6e 74 28 33 33 | 30 2c 32 33 30 29 2c 0a |Point(33|0,230),.|
|00002a40| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002a50| 20 20 20 57 48 49 54 45 | 2c 20 42 4c 55 45 2c 20 | WHITE|, BLUE, |
|00002a60| 49 4e 5f 42 4f 52 44 45 | 52 2c 20 22 40 42 40 6f |IN_BORDE|R, "@B@o|
|00002a70| 62 22 29 3b 0a 20 20 20 | 20 20 20 20 20 63 32 2e |b");. | c2.|
|00002a80| 61 64 64 49 74 65 6d 28 | 50 6f 69 6e 74 28 33 34 |addItem(|Point(34|
|00002a90| 30 2c 20 32 30 30 29 2c | 20 50 6f 69 6e 74 28 34 |0, 200),| Point(4|
|00002aa0| 30 30 2c 32 33 30 29 2c | 0a 20 20 20 20 20 20 20 |00,230),|. |
|00002ab0| 20 20 20 20 20 20 20 20 | 20 20 20 20 57 48 49 54 | | WHIT|
|00002ac0| 45 2c 20 42 4c 55 45 2c | 20 49 4e 5f 42 4f 52 44 |E, BLUE,| IN_BORD|
|00002ad0| 45 52 2c 20 22 40 43 40 | 61 72 22 29 3b 0a 20 20 |ER, "@C@|ar");. |
|00002ae0| 20 20 20 20 20 20 61 20 | 3d 20 50 6f 69 6e 74 28 | a |= Point(|
|00002af0| 35 30 30 2c 20 32 33 30 | 29 3b 20 62 20 3d 20 50 |500, 230|); b = P|
|00002b00| 6f 69 6e 74 28 35 35 30 | 2c 20 33 33 30 29 3b 0a |oint(550|, 330);.|
|00002b10| 20 20 20 20 20 20 20 20 | 43 68 6f 69 63 65 20 63 | |Choice c|
|00002b20| 33 28 61 2c 62 2c 47 52 | 45 45 4e 2c 47 52 41 59 |3(a,b,GR|EEN,GRAY|
|00002b30| 2c 4e 4f 5f 42 4f 52 44 | 45 52 2c 31 30 2c 35 2c |,NO_BORD|ER,10,5,|
|00002b40| 22 40 44 40 22 2c 22 40 | 45 40 22 2c 22 40 46 40 |"@D@","@|E@","@F@|
|00002b50| 22 2c 22 40 47 40 22 2c | 22 40 48 40 22 29 3b 0a |","@G@",|"@H@");.|
|00002b60| 20 0a 20 20 20 20 20 20 | 20 20 63 31 2e 62 69 6e | . | c1.bin|
|00002b70| 64 28 68 61 6e 64 6c 65 | 72 31 29 3b 0a 20 20 20 |d(handle|r1);. |
|00002b80| 20 20 20 20 20 63 32 2e | 62 69 6e 64 28 68 61 6e | c2.|bind(han|
|00002b90| 64 6c 65 72 32 29 3b 0a | 20 20 20 20 20 20 20 20 |dler2);.| |
|00002ba0| 63 33 2e 62 69 6e 64 28 | 68 61 6e 64 6c 65 72 33 |c3.bind(|handler3|
|00002bb0| 29 3b 0a 20 20 20 20 20 | 20 20 20 45 76 65 6e 74 |);. | Event|
|00002bc0| 3a 3a 77 61 69 74 46 6f | 72 45 76 65 6e 74 73 28 |::waitFo|rEvents(|
|00002bd0| 29 3b 0a 20 20 20 20 7d | 0a 5c 65 6e 64 7b 76 65 |);. }|.\end{ve|
|00002be0| 72 62 61 74 69 6d 7d 0a | 5c 65 6e 64 7b 64 6f 63 |rbatim}.|\end{doc|
|00002bf0| 75 6d 65 6e 74 7d 0a | |ument}. | |
+--------+-------------------------+-------------------------+--------+--------+